import {createRouter,createWebHashHistory} from 'vue-router'

    const routes = [
        {
            path:'/',
            name:'main',
            component: () => import('@/pages/main/view/index.vue'),
        },
        {
            path:'/video',
            name:'video',
            component:() => import('@/pages/video/view/index.vue'),
            props: route => ({
                avid: route.query.avid,
                bvid:route.query.bvid,
                cid:route.query.cid
              })
        },
        {
            path:'/comic',
            name:'comic',
            component:() => import('@/pages/comic/view/index.vue'),
        },
        {
            path:'/dynamicTV',
            name:'dynamicTV',
            component:() => import('@/pages/tv/view/index.vue'),
        },
        {
            path:'/search',
            name:'search',
            redirect:'/search/all',
            component:() => import('@/pages/search/view/index.vue'),
            props: route => ({
                keyword: route.query.keyword
            }),
            children:[
                {
                    path: '/search/all',
                    component:() => import('@/pages/search/view/all.vue'),
                    props: route => ({
                        keyword: route.query.keyword
                    }),
                },
                {
                    path: '/search/video',
                    component:() => import('@/pages/search/view/video.vue'),
                    props: route => ({
                        keyword: route.query.keyword
                    }),
                },
                {
                    path: '/search/live',
                    component:() => import('@/pages/search/view/live.vue'),
                    props: route => ({
                        keyword: route.query.keyword
                    }),
                },
                {
                    path: '/search/bili_user',
                    component:() => import('@/pages/search/view/biliUser.vue'),
                    props: route => ({
                        keyword: route.query.keyword
                    }),
                },
                {
                    path: '/search/media_bangumi',
                    component:() => import('@/pages/search/view/mediai.vue'),
                    props: route => ({
                        keyword: route.query.keyword
                    }),
                },
                {
                    path: '/search/media_ft',
                    component:() => import('@/pages/search/view/mediaFt.vue'),
                    props: route => ({
                        keyword: route.query.keyword
                    }),
                },
                {
                    path: '/search/article',
                    component:() => import('@/pages/search/view/article.vue'),
                    props: route => ({
                        keyword: route.query.keyword
                    }),
                }
            ]
        },
        {
            path:'/up',
            name:'up',
            redirect:'/up/main',
            component:() => import('@/pages/up/view/index.vue'),
            props: route => ({
                mid: route.query.mid
            }),
            children:[
                {
                    path: '/up/main',
                    component:() => import('@/pages/up/view/main.vue'),
                    props: route => ({
                        mid: route.query.mid
                    })
                },
                {
                    path: '/up/trands',
                    component:() => import('@/pages/up/view/trands.vue'),
                    props: route => ({
                        mid: route.query.mid
                    })
                },
                {
                    path: '/up/tg',
                    redirect:'/up/tg/video',
                    component: () => import('@/pages/up/view/tg.vue'),
                    props: route => ({
                        mid: route.query.mid
                    }),
                    children: [
                        {
                            path: '/up/tg/video',
                            component:() => import('@/view/upTg/video.vue'),
                            props: route => ({
                                mid: route.query.mid
                            })
                        },
                        {
                            path: '/up/tg/audio',
                            component:() => import('@/view/upTg/audio.vue'),
                            props: route => ({
                                mid: route.query.mid
                            })
                        },
                        {
                            path: '/up/tg/article',
                            component:() => import('@/view/upTg/article.vue'),
                            props: route => ({
                                mid: route.query.mid
                            })
                        },
                        {
                            path: '/up/tg/album',
                            component:() => import('@/view/upTg/album.vue'),
                            props: route => ({
                                mid: route.query.mid
                            })
                        },
                    ]
                },
                {
                    path: '/up/list',
                    component:() => import('@/pages/up/view/list.vue'),
                    props: route => ({
                        mid: route.query.mid
                    })
                },
                {
                    path: '/up/love',
                    component:() => import('@/pages/up/view/love.vue'),
                    props: route => ({
                        mid: route.query.mid
                    }),
                }
            ]
        }
    ]

    const router = createRouter({
        history: createWebHashHistory(),
        routes: routes
    });

    export default router;